package com.ciba.demo.util;

import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

public class FileUpload {

    private FileUpload(){
        //用来获取图片的工具类
    }

    public static String File_upload(MultipartFile file, String filepath ,String fileName) {
        if (file.isEmpty()) {
            return null;
        }
        String goal = filepath + fileName ;
        File dest = new File(goal);
        try {
            file.transferTo(dest);
            return goal;
        } catch (IOException e) {
            throw new NullPointerException() ;
        }
    }
}